<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>example methods</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>
<body>
    <h1>example methods</h1>
    <hr>
    <div id="app"></div>
    	
    <p><button onclick="destroy()">卸载</button></p>
    <p><button onclick="reload()">刷新</button></p>
    <p><button onclick="tick()">数据修改</button></p>

    <script type="text/javascript">
        
        var pxs =Vue.extend({
            template:`<p>{{msg}}</p>`,
            data:function(){
                return{
                    msg:'hello, Iam pxs!'
                }
            },
            mounted:function(){
                console.log("mounted被创建")
            },
            destroyed:function(){
                console.log("destroyed销毁之后")
            },
            updated:function(){
                console.log("updated 更新之后")
            }

        })
        var vm =new pxs().$mount("#app")
        function destroy(){
            vm.$destroy();
        }
        function reload(){
            vm.$forceUpdate();
        }
        function tick(){
            vm.msg="update message info ";
            vm.$nextTick(function(){
                console.log('message更新完后我被调用了');
            })
        }
    </script>
</body>
</html>